package com.aurora.app.entity;

import java.math.BigDecimal;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.aurora.app.enums.PayState;
import com.aurora.base.entity.BaseEntity;

@Entity
@Table(name="tb_pay")
public class PayOrder extends BaseEntity {
	//支付者
	private User user;
	//应支付金额
	private BigDecimal money;
	//应到金额
	private BigDecimal toUserMoney;
	//备注
	private String tip;
	//订单状态
	private PayState state;
	//货物id
	private Thing thing;
	//订单号
	private String order;
	//预支付id
	private String prepayId;
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	@Column(name="f_money")
	public BigDecimal getMoney() {
		return money;
	}
	public void setMoney(BigDecimal money) {
		this.money = money;
	}
	@Column(name="f_tip")
	public String getTip() {
		return tip;
	}
	public void setTip(String tip) {
		this.tip = tip;
	}
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "f_status")
	public PayState getState() {
		return state;
	}
	public void setState(PayState state) {
		this.state = state;
	}
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_thing_id")
	public Thing getThing() {
		return thing;
	}
	public void setThing(Thing thing) {
		this.thing = thing;
	}
	
	@Column(name="f_to_user_money")
	public BigDecimal getToUserMoney() {
		return toUserMoney;
	}
	public void setToUserMoney(BigDecimal toUserMoney) {
		this.toUserMoney = toUserMoney;
	}
	
	@Column(name="f_order")
	public String getOrder() {
		return order;
	}
	public void setOrder(String order) {
		this.order = order;
	}
	
	@Column(name="f_prepay_id")
	public String getPrepayId() {
		return prepayId;
	}
	public void setPrepayId(String prepayId) {
		this.prepayId = prepayId;
	}
}
